//封装axios请求  http://kumanxuan1.f3322.net:8881/cms/products/recommend

//导入axios
import axios from "axios"

//创建实例
const instartes = axios.create({
    baseURL: 'http://kumanxuan1.f3322.net:8881/cms',
    timeout: 5000
})
//请求拦截器
instartes.interceptors.request.use(config => {
    let token = localStorage.getItem('x-auth-token')
    if (token) {
        config.headers["x-auth-token"] = token
    }
    return config
}, err => {
    return Promise.reject(err)
})
//响应拦截器
instartes.interceptors.response.use(config => {
    return config
}, err => {
    return Promise.reject(err)
})
export default instartes